package io.renren.modules.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.user.entity.PggorperEntity;
import io.renren.modules.user.service.PggorperService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 公司人员
 *
 * @author yangyf
 * @email 
 * @date 2022-11-18 09:29:53
 */
@RestController
@RequestMapping("user/pggorper")
public class PggorperController {
    @Autowired
    private PggorperService pggorperService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("user:pggorper:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = pggorperService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{userId}")
    @RequiresPermissions("user:pggorper:info")
    public R info(@PathVariable("userId") Long userId){
		PggorperEntity pggorper = pggorperService.getById(userId);

        return R.ok().put("pggorper", pggorper);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("user:pggorper:save")
    public R save(@RequestBody PggorperEntity pggorper){
		pggorperService.save(pggorper);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("user:pggorper:update")
    public R update(@RequestBody PggorperEntity pggorper){
		pggorperService.updateById(pggorper);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("user:pggorper:delete")
    public R delete(@RequestBody Long[] userIds){
		pggorperService.removeByIds(Arrays.asList(userIds));

        return R.ok();
    }

}
